﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using PinCity.Models.Base;

namespace PinCity.Models.Accounts
{
    /// <summary>
    /// Represents persisted roles. There should be 
    /// a set of predefined roles, that won't be modified
    /// during runtime.
    /// </summary>
    public class Role : Entity
    {
        /// <summary>
        /// Gets or sets human-readable name of the role.
        /// </summary>
        public virtual string Name { get; set; }

        /// <summary>
        /// Gets or sets localized name of the role. Used for display.
        /// </summary>
        public virtual string LocalizedName { get; set; }

        /// <summary>
        /// Gets or sets human-readable description of the role.
        /// </summary>
        public virtual string Description { get; set; }

        /// <summary>
        /// Gets or sets list of users, assigned to this role.
        /// </summary>
        public virtual IList<User> Users { get; set; }

        public Role() : this("UNDEFINED_ROLENAME", "UNDEFINED_LOCALIZED_ROLENAME","UNDEFINED_ROLE_DESCRIPTION")
        { 
        
        }

        public Role(string roleName) : this(roleName, roleName, "")
        { 
        
        }

        public Role(string roleName, string localizedRoleName, string description)
        {
            this.Name = roleName;
            this.Description = description;
            this.LocalizedName = localizedRoleName;
            this.Users = new List<User>();
        }
    }
}